package com.atguigu04.block;



/**
 * ClassName: BlockTest
 * Package: com.atguigu04.block
 * Description:
 *
 * @Author xiao_qi
 * @Create 2024/9/2 21:29
 * @Version 1.0
 */
public class BlockTest {
    public static void main(String[] args) {
        System.out.println(Person.info);
        System.out.println(Person.info);


        Person p1 = new Person();
        Person p2 = new Person();
        System.out.println(p1.age);//1
//        p1.eat();
    }
}
class Person{
    String name;
    int age;
    static String info = "我是一个人";



    //非静止代码块
    {
        System.out.println("非静止代码块1");
    }
    {
        System.out.println("非静止代码块2");
        age = 1;
        System.out.println("info = " + info);
    }

    //静止代码块
    static {
        System.out.println("静止代码块1");
    }
    static{
        System.out.println("静止代码块2");

        System.out.println("info = " + info);
    }





}